# ~*~ coding: utf-8 ~*~

from apps.blueprints import terminal_blueprint
from .views import SSHConnectorView, TreeNodeListAPI
from .views import SessionOnlineListAPI, SessionOfflineListAPI, SessionOnlineListView, SessionOfflineListView, \
    SessionRecordFileAPI, SessionReplayView
from .views import SftpConnectorView, SftpConnectorHostView, SftpHostConnectorAPI, SFTPLogAPI, SFTPLogView


# session
terminal_blueprint.add_url_rule('/api/session/online/',
                                view_func=SessionOnlineListAPI.as_view('api-session-online'))
terminal_blueprint.add_url_rule('/api/session/offline/',
                                view_func=SessionOfflineListAPI.as_view('api-session-offline'))
terminal_blueprint.add_url_rule('/session/online/',
                                view_func=SessionOnlineListView.as_view('session-online'))
terminal_blueprint.add_url_rule('/session/offline/',
                                view_func=SessionOfflineListView.as_view('session-offline'))
terminal_blueprint.add_url_rule('/session/<uuid:pk>/replay/',
                                view_func=SessionReplayView.as_view('session-replay'))
terminal_blueprint.add_url_rule('/session/<path:filename>/',
                                view_func=SessionRecordFileAPI.as_view('api-session-record-file'))

# ssh
terminal_blueprint.add_url_rule('/ssh/', view_func=SSHConnectorView.as_view('ssh-connector'))
terminal_blueprint.add_url_rule('/ssh/tree/', view_func=TreeNodeListAPI.as_view('ssh-tree'))

# sftp
terminal_blueprint.add_url_rule('/sftp/',
                                view_func=SftpConnectorView.as_view('sftp-connector'))
terminal_blueprint.add_url_rule('/api/sftp/<host>/',
                                view_func=SftpHostConnectorAPI.as_view('api-sftp-connector'))
terminal_blueprint.add_url_rule('/sftp/<host>/',
                                view_func=SftpConnectorHostView.as_view('sftp-connector-host'))
# log
terminal_blueprint.add_url_rule('/api/log/sftp/', view_func=SFTPLogAPI.as_view('api-log-sftp'))
terminal_blueprint.add_url_rule('/log/sftp/', view_func=SFTPLogView.as_view('log-sftp'))
